<template>
	<view class="StoreManagement">
		<view class="StoreBox">
			<!-- <view class="Store_top">
				<view class="Storetitle">认证门店</view>
				<view class="bindingBox" @click="toCertifiedStore">
					<view class="bindingName">选择要绑定的门店</view>
					<u-icon name="arrow-right" color="#FFAC3F" size="25"></u-icon>
				</view>
			</view> -->
			<view class="realStatus" @click="toCertifiedStore" v-if="!authInfo">
				<text>您的商店还未认证哦，马上认证</text>
				<image src="../../static/mine/realMore.png"></image>
			</view>
			<view class="realStatus" style="background: white;" @click="toCertifiedStore" v-if="authInfo&&authInfo.type==0">
				<text style="color: #333333;">审核中，审核结果48小时内回复</text>
				<image src="../../static/mine/more_black.png"></image>
			</view>
			<view class="realStatus" style="background: white;" @click="toCertifiedStore" v-if="authInfo&&authInfo.type==1">
				<view style="width: 24upx;height: 24upx;text-align: center;line-height: 24upx;border-radius: 50%;background: #FFAC3F;margin-right: 10upx;color: white;font-size: 16upx;">v</view>
				<text style="color: #333333;">认证成功，查看认证信息</text>
				<image src="../../static/mine/more_black.png"></image>
			</view>
			<view class="realStatus" style="background: white;" @click="toCertifiedStore" v-if="authInfo&&authInfo.type==2">
				<view style="width: 24upx;height: 24upx;text-align: center;line-height: 24upx;border-radius: 50%;background: #FF5555;margin-right: 10upx;color: white;font-size: 16upx;">!</view>
				<text style="color: #333333;">认证失败，请重新提交信息</text>
				<image src="../../static/mine/more_black.png"></image>
			</view>
			<view class="StoreList">
				<view class="StoreItemBox">
					<view class="StoreItem">
						<view class="Itemtitle">门店名称</view>
						<view class="Item_R">
							<view class="ItemName" @click="editName" data-type="name" :data-txt="info.name">
								{{info.name?info.name:"无"}}</view>
						</view>
					</view>
					<view class="StoreItem">
						<view class="Itemtitle">门店品类</view>
						<picker mode="selector" :range="cateList" @change="choiceCate" range-key="name"
							:value="cateIndex">
							<view class="Item_R">
								<view class="ItemName">{{info.industry?info.industry.name:"请选择"}}</view>
								<u-icon name="arrow-right" color="#BFBFBF" size="25"></u-icon>
							</view>
						</picker>
					</view>
					<!-- 选择门店分类 -->
					<view class="sheetBox">
						<u-action-sheet :list="ClassList" v-model="showClass" @click="selectClass"></u-action-sheet>
					</view>
					<!-- 选择门店分类 -->
					<view class="StoreItem">
						<view class="Itemtitle">门店电话</view>
						<view class="Item_R">
							<view class="ItemName" @click="editName1" data-type="phone" :data-txt="info.mobile">
								{{info.mobile?info.mobile:"无"}}</view>
						</view>
					</view>
					<view class="StoreItem">
						<view class="Itemtitle">所属区域</view>
						<picker mode="multiSelector" :range="addressList" range-key="name" @change="choiceAddress" @columnchange="changeProvince">
							<view class="Item_R">
								<view class="ItemName">{{cityStr?cityStr:(info.address?info.address:'请选择')}}</view>
								<u-icon name="arrow-right" color="#BFBFBF" size="25"></u-icon>
							</view>
						</picker>
					</view>
					<view class="StoreItem">
						<view class="Itemtitle">所属商圈</view>
						<view class="Item_R" @click="toDistrict">
							<view class="ItemName ellipsis">{{info.business_areas?info.business_areas.name:"请选择"}}</view>
							<u-icon name="arrow-right" color="#BFBFBF" size="25"></u-icon>
						</view>
					</view>
					<view class="StoreItem">
						<view class="Itemtitle">门店地址</view>
						<view class="Item_R" @click="toStoreAddress">
							<view class="ItemName ellipsis">{{info.detailed_address?info.detailed_address:"请选择"}}</view>
							<u-icon name="arrow-right" color="#BFBFBF" size="25"></u-icon>
						</view>
					</view>
					<view class="StoreItem">
						<view class="Itemtitle">营业时间</view>
						<view class="Item_R" @click="toBusinessHours">
							<view class="ItemName">查看</view>
							<u-icon name="arrow-right" color="#BFBFBF" size="25"></u-icon>
						</view>
					</view>
					<view class="StoreItem">
						<view class="Itemtitle">营业状态</view>
						<view class="Item_R" @click="showStatus=true">
							<view class="ItemName" v-if="info.is_opening==1">营业中</view>
							<view class="ItemName" v-if="info.is_opening==2">休息中</view>
							<view class="ItemName" v-if="info.is_opening==3">已闭馆</view>
							<view class="ItemName" v-if="info.is_opening==4">装修中</view>
							<u-icon name="arrow-right" color="#BFBFBF" size="25"></u-icon>
						</view>
					</view>
					<!-- 选择营业状态 -->
					<view class="sheetBox">
						<u-action-sheet :list="statusList" v-model="showStatus" @click="selectStatus"></u-action-sheet>
					</view>
					<!-- 选择营业状态 -->
					<!-- <view class="StoreItem" @click="toGroupOrder">
						<view class="Itemtitle">团单管理</view>
						<view class="Item_R">
							<u-icon name="arrow-right" color="#BFBFBF" size="25"></u-icon>
						</view>
					</view> -->
					<view class="imgTit">门店头图</view>
					<view class="imgTip">门店主图必须上传，图片可以是门店logo、门店招牌.</view>
					<view class="imgWrap" @click="choiceImg" v-if="!imageUrl">
						<image src="../../static/mine/photo.png"></image>
					</view>
					<view style="width: 112upx;height: 112upx;border-radius: 8upx;background-position: center;background-size: cover;" :style="{'background-image':'url('+getImage(imageUrl)+')'}" v-if="imageUrl" @click="choiceImg"></view>
					<!-- <image :src="getImage(imageUrl)" style="width: 112upx;height: 112upx;border-radius: 8upx;" v-if="imageUrl" @click="choiceImg"></image> -->
					<view class="StoreItem" @click="toExhibition">
						<view class="Itemtitle">门店展示图</view>
						<view class="Item_R">
							<u-icon name="arrow-right" color="#BFBFBF" size="25"></u-icon>
						</view>
					</view>
				</view>

				<view class="StoreItemBox">
					<view class="StoreItem">
						<view class="Itemtitle">商户标签</view>
						<view class="Item_R" @click="showlabel=true">
							<view class="ItemName">查看</view>
							<u-icon name="arrow-right" color="#BFBFBF" size="25"></u-icon>
						</view>
					</view>
					<view class="StoreItem">
						<view class="Itemtitle">基础设施</view>
						<view class="Item_R" @click="showlabel1=true">
							<view class="ItemName">查看</view>
							<u-icon name="arrow-right" color="#BFBFBF" size="25"></u-icon>
						</view>
					</view>
					<!-- <view class="StoreItem">
						<view class="Itemtitle">特色服务</view>
						<view class="Item_R">
							<u-icon name="arrow-right" color="#BFBFBF" size="25"></u-icon>
						</view>
					</view> -->
				</view>

				<view class="StoreItemBox">
					<!-- <view class="StoreItem">
						<view class="Itemtitle">门店维护教程</view>
						<view class="Item_R">
							<u-icon name="arrow-right" color="#BFBFBF" size="25"></u-icon>
						</view>
					</view> -->
					<view class="StoreItem" @click="toCoustomer">
						<view class="Itemtitle">在线客服</view>
						<view class="Item_R">
							<u-icon name="arrow-right" color="#BFBFBF" size="25"></u-icon>
						</view>
					</view>
				</view>
			</view>
		</view>
		<!-- 选择商户标签 -->
		<view class="popupBox">
			<u-popup v-model="showlabel" mode="bottom" height="600">
				<view class="popup_top">
					<view class="cancel" @click="showlabel=false">取消</view>
					<view class="title">商户标签</view>
					<view style="display: flex;align-items: center;">
						<view class="determine" style="margin-right: 30upx;" @click="addLabel = true">新增标签</view>
						<view class="determine" @click="determineBtn">确定</view>
					</view>
				</view>
				<scroll-view scroll-y="true" class="labelBox" @scrolltolower="loadMoreLabel">
					<view class="labelItem" :class="{current:item.checked}" v-for="(item,index) in labelItem" :key="index"	@click="selectLabel(index)">{{item.name}}</view>
				</scroll-view>
			</u-popup>
		</view>
		<view class="popupBox">
			<u-popup v-model="showlabel1" mode="bottom" height="600">
				<view class="popup_top">
					<view class="cancel" @click="showlabel1=false">取消</view>
					<view class="title">基础设施</view>
					<view style="display: flex;align-items: center;">
						<view class="determine" style="margin-right: 30upx;" @click="addLabel1 = true">新增标签</view>
						<view class="determine" @click="determineBtn1">确定</view>
					</view>
				</view>
				<scroll-view scroll-y="true" class="labelBox" @scrolltolower="loadMoreLabel1">
					<view class="labelItem" :class="{current:item.checked}" v-for="(item,index) in labelItem1"
 :key="index" @click="selectLabel1(index)">{{item.name}}</view>
				</scroll-view>
			</u-popup>
		</view>
		<!-- <u-popup :show="showInput" @close="close" @open="open">
			<view>
				<input type="text" v-model="inpVal" />
			</view>
		</u-popup> -->
		<view class="userNameModal">
			<u-modal v-model="showInput1" @confirm="confirmInput" title="修改" :show-cancel-button="true">
				<view class="slot-content">
					<input type="number" v-model="inpVal" :focus="true" placeholder="请输入" />
				</view>
			</u-modal>
		</view>
		<view class="userNameModal">
			<u-modal v-model="showInput" @confirm="confirmInput" title="修改" :show-cancel-button="true">
				<view class="slot-content">
					<input type="text" v-model="inpVal" :focus="true" placeholder="请输入" />
				</view>
			</u-modal>
		</view>
		<view class="userNameModal">
			<u-modal v-model="addLabel" @confirm="confirmLabel" title="添加标签" :show-cancel-button="true">
				<view class="slot-content">
					<input type="text" v-model="labelVal" :focus="true" placeholder="请输入标签" />
				</view>
			</u-modal>
		</view>
		<view class="userNameModal">
			<u-modal v-model="addLabel1" @confirm="confirmLabel1" title="添加基础设施" :show-cancel-button="true">
				<view class="slot-content">
					<input type="text" v-model="labelVal1" :focus="true" placeholder="请输入" />
				</view>
			</u-modal>
		</view>
		<!-- 选择商户标签 -->
		<mpvue-picker :themeColor="themeColor" ref="mpvuePicker" :mode="mode" :deepLength="deepLength"
			:pickerValueDefault="pickerValueDefault" @onConfirm="onConfirm" @onCancel="onCancel"
			:pickerValueArray="pickerValueArray"></mpvue-picker>
		<u-toast ref="uToast" />
	</view>
</template>

<script>
	const app = getApp();
	import mpvuePicker from '@/components/mpvue-picker/mpvuePicker.vue';
	export default {
		components: {
			mpvuePicker
		},
		data() {
			return {
				labelVal:"",
				cityStr:"",
				addLabel:false,
				labelVal1:"",
				addLabel1:false,
				imageUrl:"",
				ClassList: [{
					text: '鱼类'
				}, {
					text: '蔬菜'
				}, {
					text: '海鲜'
				}], //门店品类数据
				statusList: [{
					text: '已闭馆',
					id:3
				}, {
					text: '营业中',
					id:1
				}, {
					text: '休息中',
					id:2
				}, {
					text: '装修中',
					id:4
				}],
				showStatus: false,
				showClass: false,
				category: "", //品类
				Address: "", //地址
				BusinessHours: "", //营业时间
				Status: "",
				showlabel: false,
				showlabel1: false,
				labelItem: [],
				labelItem1: [],
				selectValue: [], //选择好的标签
				inpVal: "",
				showInput: false,
				district:{},
				pickerValueArray: [{
						label: '北京市',
						value: 110000
					},
					{
						label: '天津市',
						value: 120000
					},
					{
						label: '广州市',
						value: 440100
					},
					{
						label: '深圳市',
						value: 440300
					}
				],
				themeColor: '#007AFF',
				mode: '',
				deepLength: 1,
				pickerValueDefault: [0],
				index: 0,
				id: "",
				info: {},
				inpType: "",
				cateList: [],
				cateIndex: "",
				addressList:[[],[],[]],
				authInfo:{},
				page1:1,
				page2:1,
				limit:100,
				moreFlag1:false,
				moreFlag2:false,
				showInput1:false,
				selectLabelList:[],
				selectLabelList1:[]
			}
		},
		onNavigationBarButtonTap(e) {
			this.showSinglePicker();
		},
		onReady() {
			this.setStyle(0, '北京市');
		},
		onBackPress() {
			if (this.$refs.mpvuePicker.showPicker) {
				this.$refs.mpvuePicker.pickerCancel();
				return true;
			}
		},
		onUnload() {
			if (this.$refs.mpvuePicker.showPicker) {
				this.$refs.mpvuePicker.pickerCancel();
			}
		},
		onLoad(options) {
			this.id = options.id;
			this.getAddress(0);
			this.getCateList();
			this.getLabel();
			this.getLabel1();

		},
		methods: {
			getImage(url){
				return app.$vm.globalData.imgBaseUrl + url;
			},
			toCoustomer(){
				uni.navigateTo({
					url:"/pages/pagetwo/pages/coustomer/coustomer"
				})
			},
			loadMoreLabel(){

				if(!this.moreFlag1){
					return false;
				}
				this.moreFlag1 = false;
				this.page1 = this.page1 + 1;
				this.getLabel();
			},
			loadMoreLabel1(){

				if(!this.moreFlag2){
					return false;
				}
				this.moreFlag2 = false;
				this.page2 = this.page2 + 1;
				this.getLabel1();
			},
			getAuth(){
				this.$u.api.shopAuthenticationDetails({shop_id:this.id}).then(res=>{
					this.authInfo = res.data.details;
				})
			},
			confirmLabel(){
				let obj = {};
				obj.name = this.labelVal;
				obj.shop_id = this.id;
				obj.type = 1;
				this.$u.api.labelAdd(obj).then(res=>{
					this.$refs.uToast.show({
						title:"添加成功",
						type:"success",
						duration:2000
					})
					this.page1 = 1;
					this.getLabel();
				})
			},
			confirmLabel1(){
				let obj = {};
				obj.name = this.labelVal1;
        obj.shop_facilities_id = this.id;
				obj.type = 3;
				this.$u.api.labelAdd(obj).then(res=>{
					this.$refs.uToast.show({
						title:"添加成功",
						type:"success",
						duration:2000
					})
					this.page2 = 1;
					this.getLabel1();
				})
			},
			getLabel(){
				let obj = {};
				obj.type = 1;
				obj.page = this.page1;
				obj.limit = this.limit;
				this.$u.api.labelList(obj).then(res=>{
					this.$u.api.shopLabelList({shop_id:this.id}).then(rep=>{
						this.selectLabelList = rep.data;
						let arrs = [];
						for(let i=0;i<res.list.length;i++){
							let flags = false;
							for(let j=0;j<this.selectLabelList.length;j++){
								if(res.list[i].id == this.selectLabelList[j].id){
									flags = true;
								}
							}
							let objs = res.list[i];
							objs.checked = flags;
							arrs.push(objs);
						}
						if(this.page1 == 1){
							this.labelItem = arrs;
						}else{
							this.labelItem = this.labelItem.concat(arrs);
						}
						if(this.page1<res.list.last_page){
							this.moreFlag1 = true;
						}else{
							this.moreFlag1 = false;
						}
					})
				})
			},
			getLabel1(){
				let obj = {};
				obj.type = 3;
				obj.page = this.page2;
				obj.limit = this.limit;
				this.$u.api.labelList(obj).then(res=>{
					var onjs = {};
					onjs.shop_id = this.id;
					this.$u.api.shopFacilitiesLabelList(onjs).then(rep=>{
						this.selectLabelList1 = rep.data;
						let arrs = [];
						for(let i=0;i<res.list.length;i++){
							let flags = false;
							for(let j=0;j<this.selectLabelList1.length;j++){
								if(res.list[i].id == this.selectLabelList1[j].id){
									flags = true;
								}
							}
							let objs = res.list[i];
							objs.checked = flags;
							arrs.push(objs);
						}
						if(this.page2 == 1){
							this.labelItem1 = arrs;
						}else{
							this.labelItem1 = this.labelItem1.concat(arrs);
						}
						if(this.page2<res.list.last_page){
							this.moreFlag2 = true;
						}else{
							this.moreFlag2 = false;
						}
					})
				})
			},
			toDistrict(){
				uni.navigateTo({
					url:"/pages/pagetwo/pages/district/district?type=edit&id="+this.info.city_id+"&proid="+this.info.id
				})
			},
			choiceAddress(e){
				this.cityArr = e.detail.value;
				this.cityStr = this.addressList[0][e.detail.value[0]].name + this.addressList[1][e.detail.value[1]].name + this.addressList[2][e.detail.value[2]].name;
				let obj = {};
				obj.id = this.info.id;
				obj.province_id = this.addressList[0][e.detail.value[0]].id;
				obj.city_id = this.addressList[1][e.detail.value[1]].id;
				obj.area_id = this.addressList[2][e.detail.value[2]].id;
				// obj.user_id = this.user_id;
				obj.user_id = uni.getStorageSync("userId");
				this.$u.api.shopEdit(obj).then(res => {
					this.$refs.uToast.show({
						title: "修改成功",
						type: "success",
						duration: 2000
					})
					this.getDetail()
				})
			},
			changeProvince(e){
				if(e.detail.column==0){
					this.getAddress(this.addressList[0][e.detail.value].id,true);
				}else if(e.detail.column==1){
					this.getAddress(this.addressList[1][e.detail.value].id);
				}
			},
			getAddress(id,defaults){
				let obj = {};
				obj.area_parent_id = id?id:0;
				// obj.area_parent_id = 0;
				this.$u.api.areaList(obj).then(res=>{
					if(id==0){
						this.addressList.splice(0,1,res.data);
						this.getAddress(res.data[0].id,true);
					}else{
						if(defaults){
							this.addressList.splice(1,1,res.data);
							this.getAddress(res.data[0].id);
						}else{
							this.addressList.splice(2,1,res.data);
						}

					}
				})
			},
			choiceCate(e) {
				let obj = {};
				obj.id = this.info.id;
				obj.industry_id = this.cateList[e.detail.value].id;
				obj.user_id = uni.getStorageSync("userId");
				this.$u.api.shopEdit(obj).then(res => {
					this.$refs.uToast.show({
						title: "修改成功",
						type: "success",
						duration: 2000
					})
					this.getDetail()
				})
			},
			getCateList() {
				this.$u.api.industryList().then(res => {
					this.cateList = res.data;
					this.getDetail();
				})
			},
			confirmInput() {
				let obj = {};
				obj.id = this.info.id;
				obj.user_id = uni.getStorageSync("userId");
				if (this.inpType == "name") {
					obj.name = this.inpVal;
				}
				if (this.inpType == "phone") {
					obj.mobile = this.inpVal;
				}
				this.$u.api.shopEdit(obj).then(res => {
					this.$refs.uToast.show({
						title: "修改成功",
						type: "success",
						duration: 2000
					})
					this.getDetail()
				})
			},
			editName(e) {
				let type = e.target.dataset.type || e.currentTarget.dataset.type;
				let txt = e.target.dataset.txt || e.currentTarget.dataset.txt;
				this.inpVal = txt;
				this.inpType = type;
				this.showInput = true;
			},
			editName1(e) {
				let type = e.target.dataset.type || e.currentTarget.dataset.type;
				let txt = e.target.dataset.txt || e.currentTarget.dataset.txt;
				this.inpVal = txt;
				this.inpType = type;
				this.showInput1 = true;
			},
			close() {
				this.showInput = false;
			},
			close1() {
				this.showInput1 = false;
			},
			getDetail() {
				let obj = {};
				obj.id = this.id;
				// obj.user_id = this.id;
				obj.user_id = uni.getStorageSync("userId");
				this.$u.api.shopDetails(obj).then(res => {
					this.info = res.data;
					for (let i = 0; i < this.cateList.length; i++) {
						if (this.cateList[i].id == this.info.industry.id) {
							this.cateIndex = i;
						}
					}
					this.imageUrl = this.info.image_url;
					this.getAuth();
				})
			},
			onCancel(e) {
			},
			// 单列
			showSinglePicker() {
				this.mode = 'selector';
				this.deepLength = 1;
				this.pickerValueDefault = [0];
				this.$refs.mpvuePicker.show();
			},
			onConfirm(e) {
				this.setStyle(0, e.label);
			},
			setStyle(index, text) {
				let pages = getCurrentPages();
				let page = pages[pages.length - 1];
				if (text.length > 3) {
					text = text.substr(0, 3) + '...';
				}
				// #ifdef APP-PLUS
				let currentWebview = page.$getAppWebview();
				let titleNView = currentWebview.getStyle().titleNView;
				// 添加文字过长截取为3个字符，请根据自己业务需求更改
				titleNView.buttons[0].text = text;
				currentWebview.setStyle({
					titleNView: titleNView
				});
				// #endif
			},
			choiceImg(){
				let _this = this;
				uni.chooseImage({
					count:1,
					sizeType:["compressed"],
					success(result) {
						app.$vm.updataAvator(result.tempFilePaths[0]).then(results=>{
							_this.imageUrl = results;
							let obj = {};
							obj.id = _this.info.id;
							obj.image_url = results;
							obj.user_id = uni.getStorageSync("userId");
							_this.$u.api.shopEdit(obj).then(res => {
								_this.$refs.uToast.show({
									title: "修改成功",
									type: "success",
									duration: 2000
								})
								_this.getDetail()
							})
						});
					},
					fail:err=>{
						if(err.errMsg!='chooseImage:fail cancel'){
							app.$vm.checkAuth("scope.camera").then(resultConfirm=>{
								if(resultConfirm){
									uni.showModal({
										title:"系统繁忙，请稍后再试"
									})
								}else{
									uni.showModal({
										title:"请检查摄像头和相册权限后重试"
									})
								}
							})
						}
					}
				})
			},
			//确认选中的标签
			determineBtn() {
				let obj = this.labelItem.filter(item => {
					return item.checked == true
				})
				this.selectValue = obj;
				this.showlabel = false;
				let objs = {};
				objs.shop_id = this.id;
				objs.label_id = [];
				for(let i=0;i<obj.length;i++){
					objs.label_id.push(obj[i].id);
				}
				this.$u.api.shopLabelEdit(objs).then(res=>{
					this.$refs.uToast.show({
						title:"保存成功",
						type:"success",
						duration:2000
					})
					this.page1 = 1;
					this.getLabel();
				})
			},
			//确认选中的标签
			determineBtn1() {
				let obj = this.labelItem1.filter(item => {
					return item.checked == true
				})
				this.showlabel1 = false;
				let objs = {};
				objs.shop_id = this.id;
				objs.label_id = [];
				for(let i=0;i<obj.length;i++){
					objs.label_id.push(obj[i].id);
				}
				
				this.$u.api.shopFacilitiesLabelEdit(objs).then(res=>{
					this.$refs.uToast.show({
						title:"保存成功",
						type:"success",
						duration:2000
					})
					this.page2 = 1;
					this.getLabel1();
				})

				
			},
			//选择标签
			selectLabel(index) {
				for (let i = 0; i < this.labelItem.length; i++) {
					if (i == index) {
						if (!this.labelItem[i].checked) {
							this.labelItem[i].checked = true
						} else {
							this.labelItem[i].checked = false
						}
					}
				}

			},
			//选择标签
			selectLabel1(index) {
				for (let i = 0; i < this.labelItem1.length; i++) {
					if (i == index) {
						if (!this.labelItem1[i].checked) {
							this.labelItem1[i].checked = true
						} else {
							this.labelItem1[i].checked = false
						}
					}
				}

			},
			//门店展示图
			toExhibition() {
				let arr = [];
        
				for(let i=0;i<this.info.images.length;i++){
					arr.push(this.info.images[i].image_url);
				}
				uni.setStorageSync("imgDatas",arr)
				uni.navigateTo({
					url: "/pages/pagetwo/pages/Exhibition/Exhibition?id="+this.info.id
				})
			},
			//团单管理
			toGroupOrder() {
				uni.navigateTo({
					url: "/pages/pagethree/pages/GroupOrder/GroupOrder"
				})
			},
			//选择营业状态
			selectStatus(index) {
				this.Status = this.statusList[index].text;
				let obj = {};
				obj.id = this.info.id;
				obj.user_id = uni.getStorageSync("userId");
				obj.is_opening = this.statusList[index].id;
				
				this.$u.api.shopEdit(obj).then(res => {
					
					this.$refs.uToast.show({
						title: "修改成功",
						type: "success",
						duration: 2000
					})
					this.getDetail()
				})
			},
			//选择营业时间
			toBusinessHours() {
				let obj = {};
				obj.week = this.info.week;
				obj.day_end = this.info.day_end;
				obj.day_start = this.info.day_start;
				uni.setStorageSync("weekData",obj);
				uni.navigateTo({
					url: "/pages/pageone/pages/BusinessHours/BusinessHours?id="+this.info.id
				})
			},
			//选择门店地址
			toStoreAddress() {
				let _this = this;

				uni.chooseLocation({
					latitude: this.info.dimension>0?Number(this.info.dimension):23,
					longitude: this.info.longitude>0?Number(this.info.longitude):113,
					success: function(res) {
						
						
						
						
						
						
						let obj = {};
						obj.id = _this.info.id;
						obj.dimension = res.latitude;
						obj.longitude = res.longitude;
						obj.detailed_address = res.address;
						_this.$u.api.shopEdit(obj).then(res => {
							
							_this.$refs.uToast.show({
								title: "修改成功",
								type: "success",
								duration: 2000
							})
							_this.getDetail()
						})
					}
				});
			},
			//选择品类
			selectClass(index) {
				this.category = this.ClassList[index].text
			},
			//认证门店
			toCertifiedStore() {
				if(this.authInfo){
					this.authInfo.name = this.info.name;
					this.authInfo.address = this.info.detailed_address;
					uni.setStorageSync("authInfo",this.authInfo);
				}else{
					uni.setStorageSync("authInfo",{name:this.info.name,address:this.info.detailed_address});
				}
				uni.navigateTo({
					url: "/pages/pagefive/pages/storeReal/storeReal?id="+this.id
				})
				// uni.navigateTo({
				// 	url:"../CertifiedStore/CertifiedStore"
				// })
			}
		}
	}
</script>

<style scoped lang="less">
	.imgTit{
		margin-top: 32upx;
		font-size: 28upx;
		line-height: 28upx;
		color: #333333;
		margin-bottom: 24upx;
	}
	.imgTip{
		font-size: 20upx;
		line-height: 20upx;
		color: #333333;
		margin-bottom: 20upx;
	}
	.imgWrap{
		width: 112upx;
		height: 112upx;
		display: flex;
		align-items: center;
		justify-content: center;
		border-radius: 8upx;
		box-sizing: border-box;
		border: 2upx dashed #707070;
		margin-right: 20upx;
	}
	.imgWraps{
		width: 112upx;
		height: 112upx;
		border-radius: 8upx;
		box-sizing: border-box;
		/* margin-right: 20upx; */
		background-position: center;
		background-size: cover;
		/* margin-bottom: 20upx; */
	}
	.imgWrapsBox{
		width: 112upx;
		border-radius: 8upx;
		box-sizing: border-box;
		margin-right: 20upx;
		margin-bottom: 20upx;
	}
	.imgWrap>image{
		width: 48upx;
		height: 48upx;
	}


	.userNameModal {
		.slot-content {
			padding: 64upx;
			text-align: center;
		}
	}

	.realStatus {
		width: 100%;
		height: 72upx;
		position: fixed;
		left: 0;
		top: 16upx;
		display: flex;
		align-items: center;
		justify-content: center;
		background: #FFF7F5;
	}

	.realStatus>text {
		font-size: 28upx;
		line-height: 28upx;
		color: #FF5555;
		margin-right: 4upx;
	}

	.realStatus>image {
		width: 32upx;
		height: 32upx;
	}


	.StoreManagement {
		background-color: #F3F3F3;
		min-height: 100vh;
		padding-top: 104upx;

		// overflow: auto;
		.popupBox {
			.popup_top {
				width: 750upx;
				display: flex;
				justify-content: space-between;
				align-items: center;
				padding: 32upx 24upx;
				border-bottom: 2upx solid #EFEFEF;
				z-index: 999;

				.cancel {
					font-size: 24upx;
					font-family: Source Han Sans CN;
					font-weight: 400;
					color: #333333;
				}

				.title {
					font-size: 28upx;
					font-family: Source Han Sans CN;
					font-weight: 400;
					color: #333333;
				}

				.determine {
					font-size: 24upx;
					font-family: Source Han Sans CN;
					font-weight: 400;
					color: #FFAC3F;
				}
			}

			.labelBox {
				display: flex;
				flex-wrap: wrap;
				align-items: center;
				padding: 24upx;
				height: calc(600upx - 104upx);
				overflow-y: auto;
				box-sizing: border-box;

				.labelItem {
					background: #EEEEEE;
					opacity: 1;
					border-radius: 26upx;
					padding: 8upx 24upx;
					margin-right: 32upx;
					margin-bottom: 32upx;
					display: inline-block;
				}

				.current {
					background: #FFF5EA;
					color: #FFAC3F;
				}
			}
		}

		.StoreBox {
			.Store_top {
				width: 750upx;
				background-color: #fff;
				padding: 32upx 24upx;

				.Storetitle {
					font-size: 28upx;
					font-family: Source Han Sans CN;
					font-weight: 400;
					color: #FFAC3F;
					margin-bottom: 16upx;
				}

				.bindingBox {
					display: flex;
					justify-content: space-between;
					align-items: center;
					padding: 16upx 0;
					border-bottom: 2upx solid #EFEFEF;

					.bindingName {
						font-size: 24upx;
						font-family: Source Han Sans CN;
						font-weight: 400;
						color: #D0D0D0;
					}
				}
			}

			.StoreList {

				// margin-top: 16upx;
				.StoreItemBox {
					width: 750upx;
					padding: 0 24upx;
					margin-bottom: 16upx;
					background-color: #fff;

					.StoreItem {
						display: flex;
						justify-content: space-between;
						align-items: center;
						padding: 32upx 0;

						.Itemtitle {
							font-size: 28upx;
							font-family: Source Han Sans CN;
							font-weight: 400;
							color: #333333;
						}

						.Item_R {
							display: flex;
							align-items: center;

							.ItemName {
								font-size: 24upx;
								font-family: Source Han Sans CN;
								font-weight: 400;
								color: #333333;
							}

							.ellipsis {
								width: calc(750upx - 250upx);
								overflow: hidden;
								white-space: nowrap;
								text-overflow: ellipsis;
								text-align: right;
							}
						}
					}
				}
			}
		}
	}
</style>
